package com.keyin.protocol;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONObject;

import com.keyin.android.util.ReflectionFactory;

public class NewPeriodicals extends JsonBean{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 4902187425995694284L;
	public List<Periodical> magazines = new ArrayList<Periodical>();

	@Override
	public JsonBean parse(JSONObject jsonObj) throws Exception {
		
		JSONArray array = jsonObj.getJSONArray("new_magazines");
		for (int i = 0; i < array.length(); i ++){
			Periodical nm = (Periodical) ReflectionFactory.create(array.getJSONObject(i), Periodical.class);
			
			magazines.add(nm);
		}
		
		return super.parse(jsonObj);
	}
}
